package com.cskaoyan;

import com.cskaoyan.utils.DBCPUtils;
import org.junit.Test;

import java.sql.Connection;
import java.sql.PreparedStatement;
import java.sql.ResultSet;
import java.sql.SQLException;

/**
 * 创建日期: 2022/07/05 16:10
 *
 * @author ciggar
 */
public class Main {


    public static void main(String[] args) throws SQLException {

        // 获取连接
        Connection connection = DBCPUtils.getConnection();


        // 执行sql语句
        PreparedStatement ps = connection.prepareStatement("select * from account where id = ?");

        ps.setInt(1,1988);

        ResultSet resultSet = ps.executeQuery();

        while (resultSet.next()) {

            int id = resultSet.getInt("id");
            String name = resultSet.getString("name");

            System.out.println("id:" + id + ", name:" + name);
        }


        resultSet.close();
        ps.close();
        connection.close();


    }


    @Test
    public void test01(){




    }
}
